package com.yx.robot.bean.robot;


import com.yx.robot.product.Product;

import java.util.ArrayList;
import java.util.List;

public class Robot extends Device implements Clear {

    private Product product;
    /**
     * 机器状态(机器上报的信息, 只能用于显示)：
     * 清扫模式
     * 状态
     * 电量
     * 水量
     * 有无拖布
     */
    private RobotStatus robotStatus;

    /**
     * 勿扰时间列表
     */
    private List<QuietHour> quietHourList;

    /**
     * 预约列表
     */
    private List<Appointment> appointmentList;

    /**
     * 清洁设置(可手动设置的信息)
     * 风力
     * 水量
     * 拖布
     * 断点续扫
     * 地毯增压
     * 精擦
     */
    private CleanSettings cleanSettings;

    /**
     * 机器信息(基本不变的信息)
     * <p>
     * "botName"	    string	机器名
     * "battery" 		int	    电池容量
     * "tank" 		int	    水箱容量
     * "audioVolume"	int		音量
     * "audioBag"	    enum	语音包
     * "compileVerions"	string	固件版本
     * "mcuVersion"		string  MCU版本
     * "uuid"			string  uuid
     * "serialNumber"	string	序列号
     * "macAddr"		string  Mac地址
     * "ipAddr"			string  IP地址
     * "connectedSsid"	string  连接热点名称
     */
    private FirmwareInfo firmwareInfo;

    /**
     * 清扫统计
     * "cleanTime"	     	    当前清扫时间
     * "historyTime"			当前清扫时间
     * "cleanArea"	           	历史清扫面积
     * "historyArea"			历史清扫面积
     * "cleanCount"			    历史清扫次数
     */
    private CleanStatistics cleanStatistics;

    /**
     * 耗材损耗情况
     * "mainBrush"	    int 主刷使用时间
     * "mainBrushLife"	int	主刷寿命
     * "sideBrush"		int	边刷使用时间
     * "sideBrushLife"	int	边刷寿命
     * "strainer"		int	滤网使用时间
     * "strainerLife"	int	滤网寿命
     * "sensor"			int 传感器使用时间
     * "sensorLife"		int	传感器寿命
     */
    private Consumption consumption;
    /**
     * 摄像头设置
     */
    private CameraSettings cameraSettings;

    private FirmwareUpdateInfo firmwareUpdateInfo;

    private Map map;

    private BaseStation baseStation;
    /**
     * 设置临时变量数据
     */
    private SetTemporaryPara setTemporaryPara;

    private int equipmentType;//设备类型（0：扫地机，1：基站）
    private boolean listSelected = false;//用于列表是否选中
    private boolean tag = false;

    public boolean isTag() {
        return tag;
    }

    public void setTag(boolean tag) {
        this.tag = tag;
    }

    public boolean isListSelected() {
        return listSelected;
    }

    public void setListSelected(boolean listSelected) {
        this.listSelected = listSelected;
    }

    public int getEquipmentType() {
        return equipmentType;
    }

    public void setEquipmentType(int equipmentType) {
        this.equipmentType = equipmentType;
    }

    public Robot() {
        map = new Map();
        product = new Product();
        cleanSettings = new CleanSettings();
        firmwareInfo = new FirmwareInfo();
        consumption = new Consumption();
        robotStatus = new RobotStatus();
        cleanStatistics = new CleanStatistics();
        quietHourList = new ArrayList<>();
        appointmentList = new ArrayList<>();
        firmwareUpdateInfo = new FirmwareUpdateInfo();
        baseStation = new BaseStation();
        setTemporaryPara = new SetTemporaryPara();
        cameraSettings = new CameraSettings();
    }

    public List<QuietHour> getQuietHourList() {
        return quietHourList;
    }

    public void setQuietHourList(List<QuietHour> quietHourList) {
        this.quietHourList = quietHourList;
    }

    public List<Appointment> getAppointmentList() {
        return appointmentList;
    }

    public void setAppointmentList(List<Appointment> appointmentList) {
        this.appointmentList = appointmentList;
    }

    public RobotStatus getRobotStatus() {
        return robotStatus;
    }

    public void setRobotStatus(RobotStatus status) {
        robotStatus = status;
    }

    public CleanSettings getCleanSettings() {
        return cleanSettings;
    }

    public void setCleanSettings(CleanSettings cleanSettings) {
        this.cleanSettings = cleanSettings;
    }

    public FirmwareInfo getFirmwareInfo() {
        return firmwareInfo;
    }

    public void setFirmwareInfo(FirmwareInfo info) {
        firmwareInfo = info;
    }

    public CleanStatistics getCleanStatistics() {
        return cleanStatistics;
    }

    public void setCleanStatistics(CleanStatistics statistics) {
        cleanStatistics = statistics;
    }

    public Consumption getConsumption() {
        return consumption;
    }

    public void setConsumption(Consumption c) {
        consumption = c;
    }

    public CameraSettings getCameraSettings() {
        return cameraSettings;
    }

    public void setCameraSettings(CameraSettings cameraSettings) {
        this.cameraSettings = cameraSettings;
    }

    public Map getMap() {
        return map;
    }

    public void setMap(Map m) {
        map = m;
    }

    public Product getProduct() {
        return product;
    }

    public void setProduct(Product product) {
        this.product = product;

    }

    public BaseStation getBaseStation() {
        return baseStation;
    }

    public void setBaseStation(BaseStation baseStation) {
        this.baseStation = baseStation;
    }

    public SetTemporaryPara getSetTemporaryPara() {
        return setTemporaryPara;
    }

    public void setSetTemporaryPara(SetTemporaryPara setTemporaryPara) {
        this.setTemporaryPara = setTemporaryPara;
    }

    @Override
    public void setProductId(String productId) {
        super.setProductId(productId);
    }

    public FirmwareUpdateInfo getFirmwareUpdateInfo() {
        return firmwareUpdateInfo;
    }

    public void setFirmwareUpdateInfo(FirmwareUpdateInfo firmwareUpdateInfo) {
        if (firmwareUpdateInfo == null) {
            this.firmwareUpdateInfo.clear();
        } else {
            this.firmwareUpdateInfo.setDesc(firmwareUpdateInfo.getDesc());
            this.firmwareUpdateInfo.setUpgradeStatus(firmwareUpdateInfo.getUpgradeStatus());
            this.firmwareUpdateInfo.setNewVersion(firmwareUpdateInfo.getNewVersion());
            this.firmwareUpdateInfo.setCurrentVersion(firmwareUpdateInfo.getCurrentVersion());
            this.firmwareUpdateInfo.setUpgradeType(firmwareUpdateInfo.getUpgradeType());
        }
    }

    @Override
    public void clear() {
        map.clear();
        cleanSettings = new CleanSettings();
        firmwareInfo = new FirmwareInfo();
        consumption = new Consumption();
        robotStatus = new RobotStatus();
        cleanStatistics = new CleanStatistics();
        quietHourList.clear();
        appointmentList.clear();
        firmwareUpdateInfo.clear();
    }

    @Override
    public String toString() {
        return "Robot{" +
                super.toString() +
                "product=" + product +
                ", robotStatus=" + robotStatus +
                ", quietHourList=" + quietHourList +
                ", appointmentList=" + appointmentList +
                ", cleanSettings=" + cleanSettings +
                ", firmwareInfo=" + firmwareInfo +
                ", cleanStatistics=" + cleanStatistics +
                ", consumption=" + consumption +
                ", cameraSettings=" + cameraSettings +
                ", firmwareUpdateInfo=" + firmwareUpdateInfo +
                ", map=" + map +
                '}';
    }
}
